/**
 * Copyright &copy; Edwin All rights reserved.
 */
package com.jeeplus.common.utils;

import cached.redis.RedisUtil;
import com.jeeplus.common.config.Global;

/**
 * Cache工具类
 * @author Parker
 * @version 2017-1-19
 */
public class CacheUtils {


	private static final String SYS_REGION = "sysCache";

	
	
	/**
	 * 获取SYS_CACHE缓存
	 * @param key
	 * @return
	 */
	public static Object get(String key) {
		return get(SYS_REGION, key);
	}
	
	/**
	 * 写入SYS_CACHE缓存
	 * @param key
	 * @return
	 */
	public static void put(String key, Object value) {
		put(SYS_REGION, key, value);
	}
	
	/**
	 * 从SYS_CACHE缓存中移除
	 * @param key
	 * @return
	 */
	public static void remove(String key) {
		remove(SYS_REGION, key);
	}



	
	/**
	 * 获取缓存
	 * @param key
	 * @return
	 */
	public static Object get(String region, String key) {
        Object cacheMap = RedisUtil.hget(Global.getEnglishName() + "_" + region, key);
		return cacheMap;
	}
	
	
	

	/**
	 * 写入缓存
	 * @param region
	 * @param key
	 * @param value
	 */
	public static void put(String region, String key, Object value) {
        RedisUtil.hset(Global.getEnglishName() + "_" + region, key,value);
	}

	/**
	 * 从缓存中移除
	 * @param region
	 * @param key
	 */
	public static void remove(String region, String key) {
        RedisUtil.hdel(Global.getEnglishName()+"_"+region, key);
	}

	
}
